<?php
/**
 * QQAS - share your knowledge to the world!
 *
 * @author		xiaochong0302 <xiaochong0302@gmail.com>
 * @copyright	Copyright (c) 2011, Koogua Studio.
 * @license		http://www.qqas.org/user_guide/license.html
 * @link		http://www.qqas.org
 * @since		Version 1.0
 * @filesource
 */


class AnnouncementModel extends Model
{


	//缓存公告
	public function cacheAnnouncements()
    {
        $results = $announcements = array();
        $field = array('announce_id','subject','target_group','start_time');
        $map = array(
            'expire_time' => array('gt', time())
        );
        $order = array('display_order' => 'asc');
        $results = $this->field($field)->where($map)->order($order)->select();
        if (!empty($results))
        {
            foreach ($results as $value)
            {
            	$announcements[$value['announce_id']] = $value;
            }
        	F('cache_announcements', $announcements);
        }
	}

}


/* End of file AnnouncementModel.class.php */
/* Location: ./App/Lib/Model/AnnouncementModel.class.php */